<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="com.wap.framework.util.Constants;"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";	
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath+"admin" + "/"%>">
		<title>广告管理</title>
		<link rel="stylesheet" type="text/css"
			href="skin/css/base.css">
		<script language="javascript" type="text/javascript"
			src="skin/js/frame/dynamic_page.js"></script>
		<script type="text/javascript">
			function doDelete()
			{
				var selCount = 0;
				var ids = document.adFM.id;
				for(var i = 0; i < ids.length; i++)
				{					
					if(ids[i].type == "checkbox" && ids[i].checked)
					{
						selCount++;
					}
				}
				
				if(selCount == 0)
				{
					alert("至少选择一项!");
					return;
				}
				
				document.adFM.action = "<%=path%>/admin/AdMgr.do";
				document.adFM.target = "main";								
				document.adFM.submit();
			}
			
			function doAdd()
			{
				document.adFM.target = "main";
				document.location = "<%=path%>/admin/ad_add.jsp";	
			}
		</script>
	</head>
	<body leftmargin="8" topmargin="8" background='skin/images/allbg.gif'>		
		<!--  内容列表   -->
		<form name="adFM" method="post">
			<input type="hidden" name="action_method" value="delete">
			<table width="98%" border="0" cellpadding="2" cellspacing="1"
				bgcolor="#D1DDAA" align="center" style="margin-top: 8px">
				<tr bgcolor="#E7E7E7">
					<td height="24" colspan="10" background="skin/images/tbg.gif">
						&nbsp;内容列表&nbsp;
					</td>
				</tr>
				<tr align="center" bgcolor="#FAFAF1" height="22">
					<td width="3%">
						选择
					</td>
					<td width="4%">
						ID
					</td>					
					<td width="15%">
						标题
					</td>
					<td width="20%">
						链接地址(href)
					</td>
					<td width="13%">
						图片地址(src)
					</td>
					<td width="6%">
						类型
					</td>
					<td width="8%">
						创建时间
					</td>									
					<td width="3%">
						状态
					</td>					
					<td width="3%">
						操作
					</td>
				</tr>
				<c:forEach items="${ads}" var="adsColl">
					<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='#FCFDEE';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
					<td>
						<input name="id" type="checkbox" value="${adsColl.id}" class="np">
					</td>
					<td>
						${adsColl.id}
					</td>					
					<td align="left">
						<a href='<%=path%>/admin/AdMgr.do?action_method=edit&adId=${adsColl.id}'><u>${adsColl.title}</u></a>
					</td>
					<td align="left">
						${adsColl.href}
					</td>
					<td align="left">
						${adsColl.source}
					</td>
					<td>
						<c:if test="${adsColl.type == 0}">
							文字广告
						</c:if>
						<c:if test="${adsColl.type == 1}">
							图片广告
						</c:if>
					</td>
					<td>
						<fmt:formatDate value="${adsColl.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
					</td>										
					<td>
						<c:if test="${adsColl.status == 1}">
							上线
						</c:if>
						<c:if test="${adsColl.status == 0}">
							下线
						</c:if>						
					</td>					
					<td>
						<a href="<%=path%>/admin/AdMgr.do?action_method=edit&adId=${adsColl.id}" target='main'>编辑</a>
					</td>
				</tr>
				</c:forEach>			
				
				<tr bgcolor="#FAFAF1">
					<td height="28" colspan="10">
						&nbsp;						
						<input class="coolbg" type="button" value="全选" onclick="selAll()"/>
						<input class="coolbg" type="button" value="取消" onclick="noSelAll()"/>
						<input class="coolbg" type="button" value="添加" onclick="doAdd()"/>
						<input class="coolbg" type="button" value="删除" onclick="doDelete()"/>						
					</td>
				</tr>
								
				<tr align="right" bgcolor="#EEF4EA">
					<td height="25" colspan="10" align="center">
						翻页代码
					</td>
				</tr>
			</table>
		</form>		
	</body>
</html>
